const app= getApp()
export default {
  props: {
    heightPercent: {
      type: Number,
      default: 0.7
    },
    radius: {
      type: String,
      default: '20rpx'
    },
    modalMargin: {
      type: Number,
      default: 80
    },
    content: {
      type: String,
      default: ''
    },
    bgColor: {
      type: String,
      default: '#fff'
    },
    maskBackgroundColor:{
      type:String,
      default:'rgba(0,0,0,0.4)'
    },
    // 点击遮罩层 关闭
    maskClick: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      // modalWidth: 100, //窗口宽度
      // modalHeight: 100 //窗口高度
    }
  },
  computed: {
    //窗口宽度
    modalWidth() {
      let { windowWidth } = app.globalData.systemInfo
      return windowWidth - this.modalMargin;
    },
    //窗口高度
    modalHeight() {
      let { windowHeight } = app.globalData.systemInfo
      return windowHeight * this.heightPercent
    }
  },
  methods: {
    toggleModal(isShow) {
      if (isShow) {
        this.$refs.popup.open(isShow)
      }else {
        this.$refs.popup.close()
      }
    }
  }
}